package com.itisyue.fun.dto;


public class BusinessException extends RuntimeException {
    private ErrorCode code;
    public BusinessException(){
        super(ErrorCode.INTERNAL_SERVER_ERROR.getDesc());
        this.code = ErrorCode.INTERNAL_SERVER_ERROR;
    }
    public BusinessException(String message){
        super(message);
        this.code = ErrorCode.BUSINESS;
    }
    public BusinessException(Throwable cause){
        super(cause.getMessage(), cause);
        this.code = ErrorCode.BUSINESS;
    }
    public BusinessException(String message, Throwable cause){
        super(message, cause);
        this.code = ErrorCode.BUSINESS;
    }
    public BusinessException(ErrorCode code){
        super(code.getDesc());
        this.code = code;
    }
    public BusinessException(ErrorCode code, String message){
        super(message);
        this.code = code;
    }

    public ErrorCode getCode() {
        return code;
    }

    public void setCode(ErrorCode code) {
        this.code = code;
    }
}
